package com.opgea.tutor.web.dto;

import com.opgea.tutor.domain.entities.Location;
import com.opgea.tutor.domain.interfaces.Marshallable;

public class LocationDTO implements Marshallable<Location> {

    private long id;
    private int radious;
    private String locationsName;

    public long getId() {
	return id;
    }

    public void setId(long id) {
	this.id = id;
    }

    public int getRadious() {
	return radious;
    }

    public void setRadious(int radious) {
	this.radious = radious;
    }

    public String getLocationsName() {
	return locationsName;
    }

    public void setLocationsName(String locationsName) {
	this.locationsName = locationsName;
    }

    @Override
    public void marshall(Location location) {
	this.id = location.getId();
	this.radious = location.getRadious();
	this.locationsName = location.getLocationsName();
    }

    @Override
    public Location unmarshall(Location location) {
	if (location.getId() == 0) {
	    location.setId(this.id);
	}
	location.setRadious(this.radious);
	location.setLocationsName(this.locationsName);
	return location;
    }

}
